package cn.tedu._09deepseek.controller;


import io.github.pigmesh.ai.deepseek.core.DeepSeekClient;
import io.github.pigmesh.ai.deepseek.core.chat.ChatCompletionResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class ChatController {

    private HttpServletRequest request;
    private HttpServletResponse response;
    private final DeepSeekClient client;

    ChatController(HttpServletRequest request, HttpServletResponse response, DeepSeekClient client) {
        this.request = request;
        this.response = response;
        this.client = client;
    }

    @GetMapping("/chat")
    public Flux<ChatCompletionResponse> chat(@RequestParam String prompt) {
        System.out.println(prompt);
        return client.chatFluxCompletion(prompt);
    }
}
